package com.xbongbong.paas.domain.entity.ext;

import com.alibaba.fastjson.JSONArray;
import com.xbongbong.paas.domain.entity.PaasListGroupEntity;
import com.xbongbong.saas.enums.ListGroupEnum;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @author: wufeng
 * @date: 2018/9/7 17:31
 * @desrcption:
 */
@Getter
@Setter
public class PaasListGroupEntityExt extends PaasListGroupEntity {
    private static final long serialVersionUID = -420775234070991104L;
    /**
     * 是否是默认分组 0
     */
    private Integer defaultGroup;

    /**
     * 默认分组别名
     */
    private String defaultAlias;

    /**
     * 将json_data条件转成条件列表
     */
    private List<ConditionsEntityExt> conditionList;

    public PaasListGroupEntityExt(ListGroupEnum groupEnum) {
        super(groupEnum);
        this.defaultGroup = 1;
    }

    public PaasListGroupEntityExt(Long id, String name, String jsonData, Integer defaultGroupCode) {
        super(id, name, jsonData, defaultGroupCode);
        this.defaultGroup = 1;
    }

    public PaasListGroupEntityExt() {
        super();
        this.defaultGroup = 0;
    }

    public List<ConditionsEntityExt> getConditionList() {
        return conditionList;
    }

    public void setConditionList(String conditionList) {
        this.conditionList = JSONArray.parseArray(conditionList, ConditionsEntityExt.class);
    }
}
